package com.example.memoizer;

import java.math.BigInteger;


public class ExpiringMemoizerDemo {

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		Memoizer<String, BigInteger> memoizer = new Memoizer<>(new ExpensiveComputation());
		System.out.println(memoizer.compute("42"));
		
		Thread.sleep(2000); // will NOT expire
		System.out.println(memoizer.compute("42"));
		
		Thread.sleep(4000); // will expire
		System.out.println(memoizer.compute("42"));
	}

}
